﻿using System;
using System.ComponentModel;
using System.Xml.Serialization;
using TechMadeira.Core.Observer;

namespace TechMadeira.Data.Classes
{
    public class Semantic : ISemantic
    {
        #region ISubject 
        
        public event UpdateEventHandler OnUpdate;

        public void Notify( object aData = null )
        {
            if ( OnUpdate != null ) OnUpdate( this, aData );
        }

        #endregion

        #region Fields
        private bool zombie;
        #endregion


        public Semantic()
        {
            Id = Guid.NewGuid();
        }

        [Browsable(false),XmlAttribute("id")]
        public Guid Id { get; set; }

        [Browsable(false),XmlIgnore]
        public bool Zombie {
            get
            {
                return zombie;
            }
            set
            {
                zombie = value; Notify();
            } 
        }
    }
}
